<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" language="java" %>

<head>
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="/layui/css/layui.css">
    <script type="text/javascript" src="/layui/layui.js"></script>
    <script src="${pageContext.request.contextPath}/js/echarts.js"  charset="utf-8"></script>
    <script src="${pageContext.request.contextPath}/js/china.js"  charset="utf-8"></script> <script type="text/javascript"></script>
</head>

<body>
<!-- 为ECharts准备一个具备大小（宽高）的Dom -->
<div id="main" style="width: 600px;height:400px;"></div>
<div id="main2" style="width: 600px;height:400px;"></div>
<div id="main3" style="width: 600px;height:400px;"></div>
<script type="text/javascript">
    layui.use(['table',"jquery","layer","form","upload"], function() {
        var upload = layui.upload;
        var table = layui.table;
        var layer = layui.layer;
        var form = layui.form;
        var $ = layui.jquery;

        // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));
    var myChart3 = echarts.init(document.getElementById('main3'));
    var myChart2 = echarts.init(document.getElementById('main2'));

        $.ajax({
        url:"${pageContext.request.contextPath}/selectAllUserDTO2"
        ,type:"post"
        ,success:function (data) {
            console.info(data.provinceCount)
            console.info(data.sexCount)
            console.info(data.ids)



    var option2 = {
        title: {
            text: '用户注册情况表'
        },
        tooltip: {},
        legend: {
            data:['人数']
        },
        xAxis: {
            data: ["一周","二周","三周"]
        },
        yAxis: {},
        series: [{
            name: '注册',
            type: 'bar',
            data: data.ids
        }]
    };










                var option3 = {
                    title : {
                        text: "地区人数分布",
                        left: 'center'
                    },
                    tooltip : {
                        trigger: 'item'
                    },
                    legend: {
                        orient: 'vertical',
                        left: 'left',
                        data:['用户人数']
                    },
                    visualMap: {
                        min: 0,
                        max: 2500,
                        left: 'left',
                        top: 'bottom',
                        text:['高','低'],           // 文本，默认为数值文本
                        calculable : true
                    },
                    toolbox: {
                        show: true,
                        orient : 'vertical',
                        left: 'right',
                        top: 'center',
                        feature : {
                            mark : {show: true},
                            dataView : {show: true, readOnly: false},
                            restore : {show: true},
                            saveAsImage : {show: true}
                        }
                    },
                    series : [
                        {
                            name: '用户人数',
                            type: 'map',
                            mapType: 'china',
                            roam: false,
                            label: {
                                normal: {
                                    show: false
                                },
                                emphasis: {
                                    show: true
                                }
                            },
                            data:data.provinceCount
                        }
                    ]
                };













                var option = {
                title: {
                    text: '用户男女比例情况表'
                },
                tooltip: {},
                legend: {
                    data:['性别']
                },
                xAxis: {
                    data: ["男","女"]
                },
                yAxis: {},
                series: [{
                    name: '数量',
                    type: 'bar',
                    data: [data.sexCount[0].value,data.sexCount[1].value]
                }]
            };


            // 使用刚指定的配置项和数据显示图表。
            myChart.setOption(option);
            myChart2.setOption(option2);
            myChart3.setOption(option3);
        }
    })
    })
</script>
</body>

</html>
